/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package br.com.webhomesites.locacao.view;

import br.com.webhomesites.locacao.contracts.IDevolucaoTotComRenovView;
import java.awt.Component;
import java.awt.event.ActionListener;
import java.awt.event.FocusEvent;
import java.awt.event.FocusListener;
import javax.swing.JTextField;

/**
 *
 * @author Webhome
 */
public class DevolucaoTotComRenovView extends javax.swing.JDialog implements IDevolucaoTotComRenovView, FocusListener {

    /**
     * Creates new form DevolucaoTotComPagView
     */
    public DevolucaoTotComRenovView(java.awt.Frame parent, boolean modal) {
        super(parent, modal);
        initComponents();
        setLocationRelativeTo(null);
        
        txtDataLocacaoAtual.setHorizontalAlignment(JTextField.RIGHT);
        txtDataPagamento.setHorizontalAlignment(JTextField.RIGHT);
        txtDataPrevDevolucao.setHorizontalAlignment(JTextField.RIGHT);
        txtDataPrevDevolucaoAtual.setHorizontalAlignment(JTextField.RIGHT);
        txtDataRenovacao.setHorizontalAlignment(JTextField.RIGHT);
        txtDiasLocacao.setHorizontalAlignment(JTextField.RIGHT);
        txtDiasLocacaoAtual.setHorizontalAlignment(JTextField.RIGHT);
        txtDiasLocacaoCalculado.setHorizontalAlignment(JTextField.RIGHT);
        txtValorDescontoValor.setHorizontalAlignment(JTextField.RIGHT);
        txtValorDescontoPorcentagem.setHorizontalAlignment(JTextField.RIGHT);
        txtValorTotal.setHorizontalAlignment(JTextField.RIGHT);
        txtValorTotalPagar.setHorizontalAlignment(JTextField.RIGHT);
        txtValorTotalRenov.setHorizontalAlignment(JTextField.RIGHT);
        txtValorTotalLocacaoAtual.setHorizontalAlignment(JTextField.RIGHT);
        
        txtValorDescontoPorcentagem.addFocusListener(this);
        txtValorDescontoValor.addFocusListener(this);
        txtValorTotal.addFocusListener(this);
        txtValorTotalLocacaoAtual.addFocusListener(this);
        txtValorTotalPagar.addFocusListener(this);
        txtValorTotalRenov.addFocusListener(this);
        txtDiasLocacao.addFocusListener(this);
        
        txtDataLocacaoAtual.setEditable(false);
        txtDiasLocacaoAtual.setEditable(false);
        txtDataPrevDevolucaoAtual.setEditable(false);
        txtValorTotalLocacaoAtual.setEditable(false);
        txtDataPagamento.setEditable(false);
        txtDiasLocacaoCalculado.setEditable(false);
        txtValorTotal.setEditable(false);
        txtValorTotalPagar.setEditable(false);
        txtDataRenovacao.setEditable(false);
        txtDataPrevDevolucao.setEditable(false);
        txtValorTotalRenov.setEditable(false);
        
        txtDiasLocacao.requestFocus();
        
    }

    /**
     * This method is called from within the constructor to initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is always
     * regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        filler1 = new javax.swing.Box.Filler(new java.awt.Dimension(0, 0), new java.awt.Dimension(0, 0), new java.awt.Dimension(32767, 0));
        painelCentralDTCP = new javax.swing.JPanel();
        pinelLocacaoAtual = new javax.swing.JPanel();
        labelValorLocacao = new javax.swing.JLabel();
        txtValorTotal = new javax.swing.JTextField();
        labelValorDescontoValor = new javax.swing.JLabel();
        txtValorDescontoValor = new javax.swing.JTextField();
        labelValorDescontoPorcentagem = new javax.swing.JLabel();
        txtValorDescontoPorcentagem = new javax.swing.JTextField();
        txtValorTotalPagar = new javax.swing.JTextField();
        labelValorPagarAtual = new javax.swing.JLabel();
        txtDataPrevDevolucaoAtual = new javax.swing.JTextField();
        txtDataLocacaoAtual = new javax.swing.JTextField();
        txtDiasLocacaoAtual = new javax.swing.JTextField();
        labelDataLocacaoAtual = new javax.swing.JLabel();
        lavelDiasLocacacaoAtual = new javax.swing.JLabel();
        lavelDataPagamento = new javax.swing.JLabel();
        txtDataPagamento = new javax.swing.JTextField();
        labelDataLocacaoAtual1 = new javax.swing.JLabel();
        lavelDiasLocacacaoAtual1 = new javax.swing.JLabel();
        txtDiasLocacaoCalculado = new javax.swing.JTextField();
        jSeparator1 = new javax.swing.JSeparator();
        txtValorTotalLocacaoAtual = new javax.swing.JTextField();
        labelValorPagarAtual1 = new javax.swing.JLabel();
        painelRenovacao = new javax.swing.JPanel();
        lavelDataPrevDevolucao = new javax.swing.JLabel();
        lavelDiasLocacaoRanovacao = new javax.swing.JLabel();
        labelDataRenov = new javax.swing.JLabel();
        txtValorTotalRenov = new javax.swing.JTextField();
        txtDataPrevDevolucao = new javax.swing.JTextField();
        labelValorLocacaoRenovacao = new javax.swing.JLabel();
        txtDiasLocacao = new javax.swing.JTextField();
        txtDataRenovacao = new javax.swing.JTextField();
        btnConfirmar = new javax.swing.JButton();
        btnCancelar = new javax.swing.JButton();
        btnRecibo = new javax.swing.JButton();

        setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
        setResizable(false);

        painelCentralDTCP.setBorder(javax.swing.BorderFactory.createTitledBorder("Devolução total com renovação"));

        pinelLocacaoAtual.setBorder(javax.swing.BorderFactory.createTitledBorder("Locação Atual"));

        labelValorLocacao.setText("Vlr.Previsto");

        txtValorTotal.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                txtValorTotalActionPerformed(evt);
            }
        });

        labelValorDescontoValor.setText("Desconto vlr.");

        labelValorDescontoPorcentagem.setText("Desconto %");

        txtValorTotalPagar.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                txtValorTotalPagarActionPerformed(evt);
            }
        });

        labelValorPagarAtual.setText("Vlr. a Pagar");

        labelDataLocacaoAtual.setText("Data Loc.");

        lavelDiasLocacacaoAtual.setText("Dias Loc.");

        lavelDataPagamento.setText("Data Prev. Dev.");

        labelDataLocacaoAtual1.setText("Data Pgto.");

        lavelDiasLocacacaoAtual1.setText("Dias Calculados");

        txtValorTotalLocacaoAtual.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                txtValorTotalLocacaoAtualActionPerformed(evt);
            }
        });

        labelValorPagarAtual1.setText("Vlr. Tot. Locação");

        javax.swing.GroupLayout pinelLocacaoAtualLayout = new javax.swing.GroupLayout(pinelLocacaoAtual);
        pinelLocacaoAtual.setLayout(pinelLocacaoAtualLayout);
        pinelLocacaoAtualLayout.setHorizontalGroup(
            pinelLocacaoAtualLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(pinelLocacaoAtualLayout.createSequentialGroup()
                .addGroup(pinelLocacaoAtualLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jSeparator1)
                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, pinelLocacaoAtualLayout.createSequentialGroup()
                        .addContainerGap()
                        .addGroup(pinelLocacaoAtualLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, pinelLocacaoAtualLayout.createSequentialGroup()
                                .addGroup(pinelLocacaoAtualLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                    .addComponent(txtDataPagamento, javax.swing.GroupLayout.PREFERRED_SIZE, 75, javax.swing.GroupLayout.PREFERRED_SIZE)
                                    .addComponent(txtValorDescontoValor, javax.swing.GroupLayout.PREFERRED_SIZE, 88, javax.swing.GroupLayout.PREFERRED_SIZE)
                                    .addComponent(labelValorDescontoValor)
                                    .addComponent(labelDataLocacaoAtual1))
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addGroup(pinelLocacaoAtualLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                                    .addComponent(txtDiasLocacaoCalculado)
                                    .addComponent(txtValorDescontoPorcentagem, javax.swing.GroupLayout.PREFERRED_SIZE, 88, javax.swing.GroupLayout.PREFERRED_SIZE)
                                    .addComponent(labelValorDescontoPorcentagem)
                                    .addComponent(lavelDiasLocacacaoAtual1)))
                            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, pinelLocacaoAtualLayout.createSequentialGroup()
                                .addGroup(pinelLocacaoAtualLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                    .addComponent(txtValorTotalLocacaoAtual, javax.swing.GroupLayout.PREFERRED_SIZE, 88, javax.swing.GroupLayout.PREFERRED_SIZE)
                                    .addComponent(labelValorPagarAtual1))
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addGroup(pinelLocacaoAtualLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                    .addComponent(txtValorTotalPagar, javax.swing.GroupLayout.PREFERRED_SIZE, 88, javax.swing.GroupLayout.PREFERRED_SIZE)
                                    .addComponent(labelValorPagarAtual)))))
                    .addGroup(pinelLocacaoAtualLayout.createSequentialGroup()
                        .addGap(23, 23, 23)
                        .addGroup(pinelLocacaoAtualLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(labelDataLocacaoAtual)
                            .addComponent(txtDataLocacaoAtual, javax.swing.GroupLayout.PREFERRED_SIZE, 85, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(pinelLocacaoAtualLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(lavelDiasLocacacaoAtual)
                            .addComponent(txtDiasLocacaoAtual, javax.swing.GroupLayout.PREFERRED_SIZE, 80, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(pinelLocacaoAtualLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(labelValorLocacao)
                            .addGroup(pinelLocacaoAtualLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                                .addComponent(txtValorTotal, javax.swing.GroupLayout.Alignment.TRAILING)
                                .addComponent(lavelDataPagamento)
                                .addComponent(txtDataPrevDevolucaoAtual, javax.swing.GroupLayout.Alignment.TRAILING)))
                        .addGap(0, 0, Short.MAX_VALUE)))
                .addContainerGap())
        );

        pinelLocacaoAtualLayout.linkSize(javax.swing.SwingConstants.HORIZONTAL, new java.awt.Component[] {lavelDataPagamento, txtDataPagamento, txtDataPrevDevolucaoAtual, txtDiasLocacaoCalculado, txtValorDescontoPorcentagem, txtValorDescontoValor, txtValorTotal, txtValorTotalLocacaoAtual, txtValorTotalPagar});

        pinelLocacaoAtualLayout.setVerticalGroup(
            pinelLocacaoAtualLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(pinelLocacaoAtualLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(pinelLocacaoAtualLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(labelDataLocacaoAtual)
                    .addComponent(lavelDiasLocacacaoAtual)
                    .addComponent(lavelDataPagamento))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(pinelLocacaoAtualLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(txtDataLocacaoAtual, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(txtDiasLocacaoAtual, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(txtDataPrevDevolucaoAtual, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(labelValorLocacao)
                .addGap(4, 4, 4)
                .addComponent(txtValorTotal, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jSeparator1, javax.swing.GroupLayout.PREFERRED_SIZE, 10, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(1, 1, 1)
                .addGroup(pinelLocacaoAtualLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(lavelDiasLocacacaoAtual1)
                    .addComponent(labelDataLocacaoAtual1))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(pinelLocacaoAtualLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(txtDiasLocacaoCalculado, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(txtDataPagamento, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(pinelLocacaoAtualLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(labelValorDescontoPorcentagem, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(labelValorDescontoValor, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                .addGap(4, 4, 4)
                .addGroup(pinelLocacaoAtualLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(txtValorDescontoPorcentagem, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(txtValorDescontoValor))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(pinelLocacaoAtualLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(labelValorPagarAtual)
                    .addComponent(labelValorPagarAtual1))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(pinelLocacaoAtualLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(txtValorTotalPagar, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(txtValorTotalLocacaoAtual, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(18, 18, 18))
        );

        painelRenovacao.setBorder(javax.swing.BorderFactory.createTitledBorder("Renovação"));

        lavelDataPrevDevolucao.setText("Data Prev. Dev.");

        lavelDiasLocacaoRanovacao.setText("Dias Loc.");

        labelDataRenov.setText("Data Renov.");

        txtValorTotalRenov.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                txtValorTotalRenovActionPerformed(evt);
            }
        });

        labelValorLocacaoRenovacao.setText("Vlr. Tot. Locação");

        btnConfirmar.setText("Confirmar");

        btnCancelar.setText("Cancelar");

        btnRecibo.setText("Recibo");

        javax.swing.GroupLayout painelRenovacaoLayout = new javax.swing.GroupLayout(painelRenovacao);
        painelRenovacao.setLayout(painelRenovacaoLayout);
        painelRenovacaoLayout.setHorizontalGroup(
            painelRenovacaoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(painelRenovacaoLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(painelRenovacaoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(painelRenovacaoLayout.createSequentialGroup()
                        .addGroup(painelRenovacaoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(labelDataRenov)
                            .addComponent(txtDataRenovacao, javax.swing.GroupLayout.PREFERRED_SIZE, 85, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(painelRenovacaoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(lavelDiasLocacaoRanovacao)
                            .addComponent(txtDiasLocacao, javax.swing.GroupLayout.PREFERRED_SIZE, 76, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(painelRenovacaoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                            .addComponent(lavelDataPrevDevolucao)
                            .addComponent(txtDataPrevDevolucao)
                            .addComponent(labelValorLocacaoRenovacao)
                            .addComponent(txtValorTotalRenov, javax.swing.GroupLayout.PREFERRED_SIZE, 88, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addGap(0, 0, Short.MAX_VALUE))
                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, painelRenovacaoLayout.createSequentialGroup()
                        .addGap(0, 0, Short.MAX_VALUE)
                        .addGroup(painelRenovacaoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, painelRenovacaoLayout.createSequentialGroup()
                                .addComponent(btnConfirmar)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(btnCancelar, javax.swing.GroupLayout.PREFERRED_SIZE, 84, javax.swing.GroupLayout.PREFERRED_SIZE))
                            .addComponent(btnRecibo, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.PREFERRED_SIZE, 84, javax.swing.GroupLayout.PREFERRED_SIZE))))
                .addContainerGap())
        );

        painelRenovacaoLayout.linkSize(javax.swing.SwingConstants.HORIZONTAL, new java.awt.Component[] {txtDataPrevDevolucao, txtDataRenovacao, txtDiasLocacao, txtValorTotalRenov});

        painelRenovacaoLayout.setVerticalGroup(
            painelRenovacaoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(painelRenovacaoLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(painelRenovacaoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(labelDataRenov)
                    .addComponent(lavelDiasLocacaoRanovacao)
                    .addComponent(lavelDataPrevDevolucao))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(painelRenovacaoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(txtDataRenovacao, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(txtDiasLocacao, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(txtDataPrevDevolucao, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(labelValorLocacaoRenovacao)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(txtValorTotalRenov, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(18, 18, 18)
                .addGroup(painelRenovacaoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(btnCancelar)
                    .addComponent(btnConfirmar))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(btnRecibo)
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );

        javax.swing.GroupLayout painelCentralDTCPLayout = new javax.swing.GroupLayout(painelCentralDTCP);
        painelCentralDTCP.setLayout(painelCentralDTCPLayout);
        painelCentralDTCPLayout.setHorizontalGroup(
            painelCentralDTCPLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, painelCentralDTCPLayout.createSequentialGroup()
                .addContainerGap()
                .addComponent(pinelLocacaoAtual, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(painelRenovacao, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );
        painelCentralDTCPLayout.setVerticalGroup(
            painelCentralDTCPLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(painelCentralDTCPLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(painelCentralDTCPLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(painelRenovacao, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(pinelLocacaoAtual, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                .addContainerGap())
        );

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(painelCentralDTCP, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(painelCentralDTCP, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addContainerGap())
        );

        pack();
    }// </editor-fold>//GEN-END:initComponents

    private void txtValorTotalActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_txtValorTotalActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_txtValorTotalActionPerformed

    private void txtValorTotalPagarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_txtValorTotalPagarActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_txtValorTotalPagarActionPerformed

    private void txtValorTotalRenovActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_txtValorTotalRenovActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_txtValorTotalRenovActionPerformed

    private void txtValorTotalLocacaoAtualActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_txtValorTotalLocacaoAtualActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_txtValorTotalLocacaoAtualActionPerformed

    /**
     * @param args the command line arguments
     */
    public static void main(String args[]) {
        /*
         * Set the Nimbus look and feel
         */
        //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
        /*
         * If Nimbus (introduced in Java SE 6) is not available, stay with the
         * default look and feel. For details see
         * http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html
         */
        try {
            for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
                if ("Nimbus".equals(info.getName())) {
                    javax.swing.UIManager.setLookAndFeel(info.getClassName());
                    break;
                }
            }
        } catch (ClassNotFoundException ex) {
            java.util.logging.Logger.getLogger(DevolucaoTotComRenovView.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (InstantiationException ex) {
            java.util.logging.Logger.getLogger(DevolucaoTotComRenovView.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (IllegalAccessException ex) {
            java.util.logging.Logger.getLogger(DevolucaoTotComRenovView.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (javax.swing.UnsupportedLookAndFeelException ex) {
            java.util.logging.Logger.getLogger(DevolucaoTotComRenovView.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        }
        //</editor-fold>

        /*
         * Create and display the dialog
         */
        java.awt.EventQueue.invokeLater(new Runnable() {

            public void run() {
                DevolucaoTotComRenovView dialog = new DevolucaoTotComRenovView(new javax.swing.JFrame(), true);
                dialog.addWindowListener(new java.awt.event.WindowAdapter() {

                    @Override
                    public void windowClosing(java.awt.event.WindowEvent e) {
                        System.exit(0);
                    }
                });
                dialog.setVisible(true);
            }
        });
    }
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JButton btnCancelar;
    private javax.swing.JButton btnConfirmar;
    private javax.swing.JButton btnRecibo;
    private javax.swing.Box.Filler filler1;
    private javax.swing.JSeparator jSeparator1;
    private javax.swing.JLabel labelDataLocacaoAtual;
    private javax.swing.JLabel labelDataLocacaoAtual1;
    private javax.swing.JLabel labelDataRenov;
    private javax.swing.JLabel labelValorDescontoPorcentagem;
    private javax.swing.JLabel labelValorDescontoValor;
    private javax.swing.JLabel labelValorLocacao;
    private javax.swing.JLabel labelValorLocacaoRenovacao;
    private javax.swing.JLabel labelValorPagarAtual;
    private javax.swing.JLabel labelValorPagarAtual1;
    private javax.swing.JLabel lavelDataPagamento;
    private javax.swing.JLabel lavelDataPrevDevolucao;
    private javax.swing.JLabel lavelDiasLocacacaoAtual;
    private javax.swing.JLabel lavelDiasLocacacaoAtual1;
    private javax.swing.JLabel lavelDiasLocacaoRanovacao;
    private javax.swing.JPanel painelCentralDTCP;
    private javax.swing.JPanel painelRenovacao;
    private javax.swing.JPanel pinelLocacaoAtual;
    private javax.swing.JTextField txtDataLocacaoAtual;
    private javax.swing.JTextField txtDataPagamento;
    private javax.swing.JTextField txtDataPrevDevolucao;
    private javax.swing.JTextField txtDataPrevDevolucaoAtual;
    private javax.swing.JTextField txtDataRenovacao;
    private javax.swing.JTextField txtDiasLocacao;
    private javax.swing.JTextField txtDiasLocacaoAtual;
    private javax.swing.JTextField txtDiasLocacaoCalculado;
    private javax.swing.JTextField txtValorDescontoPorcentagem;
    private javax.swing.JTextField txtValorDescontoValor;
    private javax.swing.JTextField txtValorTotal;
    private javax.swing.JTextField txtValorTotalLocacaoAtual;
    private javax.swing.JTextField txtValorTotalPagar;
    private javax.swing.JTextField txtValorTotalRenov;
    // End of variables declaration//GEN-END:variables

    @Override
    public void setValorTotalLocacaoPrevisto(String valorTotalLocacao) {
        txtValorTotal.setText((valorTotalLocacao));
    }

    @Override
    public double getValorTotalLocacaoPrevisto() {
        return Double.parseDouble(txtValorTotal.getText().equals("")?"0":(txtValorTotal.getText().contains(".")?txtValorTotal.getText().replace(".", "").replace(",", "."):txtValorTotal.getText().replace(",",".")));
    }

    @Override
    public void setValorTotalPagar(String valorTotalPagar) {
        txtValorTotalPagar.setText((valorTotalPagar));
    }

    @Override
    public double getValorTotalPagar() {
        return Double.parseDouble(txtValorTotalPagar.getText().equals("")?"0":(txtValorTotalPagar.getText().contains(".")?txtValorTotalPagar.getText().replace(".", "").replace(",", "."):txtValorTotalPagar.getText().replace(",",".")));
    }
    
    @Override
    public void setDiasLocacaoAtual(int diasLocacao) {
        txtDiasLocacaoAtual.setText(Integer.toString(diasLocacao));
    }

    @Override
    public int getDiasLocacaoAtual() {
        return Integer.parseInt(txtDiasLocacaoAtual.getText());
    }

    @Override
    public void setDiasLocacaoRenovacao(int diasLocacao) {
        txtDiasLocacao.setText(Integer.toString(diasLocacao));
    }

    @Override
    public int getDiasLocacaoRenovacao() {
        return Integer.parseInt(txtDiasLocacao.getText());
    }
    
    @Override
    public void setDiasLocacaoCalculado(int diasLocacao) {
        txtDiasLocacaoCalculado.setText(Integer.toString(diasLocacao));
    }

    @Override
    public int getDiasLocacaoCalculado() {
        return Integer.parseInt(txtDiasLocacaoCalculado.getText());
    }

    @Override
    public void setTabelaPreco(String tabelaPreco) {
        //combotabelaPreco.setSelectedItem(tabelaPreco);
    }

    @Override
    public String getTabelaPreco() {
        return null;//combotabelaPreco.getSelectedItem().toString();
    }

    @Override
    public void setDataRenovavao(String dataRenovacao) {
        txtDataRenovacao.setText(dataRenovacao);
    }

    @Override
    public String getDataRenovavao() {
        return txtDataRenovacao.getText();
    }

    @Override
    public void setDataPrevDevolucaoAtual(String dataPrevDevolucao) {
        txtDataPrevDevolucaoAtual.setText(dataPrevDevolucao);
    }

    @Override
    public String getDataPrevDevolucaoAtual() {
        return txtDataPrevDevolucaoAtual.getText();
    }
    
    @Override
    public void setDataPrevDevolucaoRenovacao(String dataPrevDevolucao) {
        txtDataPrevDevolucao.setText(dataPrevDevolucao);
    }

    @Override
    public String getDataPrevDevolucaoRenovacao() {
        return txtDataPrevDevolucao.getText();
    }
    
    @Override
    public void setValorTotalRenovacao(String valorTotalRenov) {
        txtValorTotalRenov.setText((valorTotalRenov));
    }

    @Override
    public double getValorTotalRenovacao() {
        return Double.parseDouble(txtValorTotalRenov.getText().equals("")?"0":(txtValorTotalRenov.getText().contains(".")?txtValorTotalRenov.getText().replace(".", "").replace(",", "."):txtValorTotalRenov.getText().replace(",",".")));
    }
    
    @Override
    public void setValorTotalLocacaoAtual(String valorTotalRenov) {
        txtValorTotalLocacaoAtual.setText((valorTotalRenov));
    }

    @Override
    public double getValorTotalLocacaoAtual() {
        return Double.parseDouble(txtValorTotalLocacaoAtual.getText().equals("")?"0":(txtValorTotalLocacaoAtual.getText().contains(".")?txtValorTotalLocacaoAtual.getText().replace(".", "").replace(",", "."):txtValorTotalLocacaoAtual.getText().replace(",",".")));
    }

    @Override
    public void setDataLocacao(String dataLocacao) {
        txtDataLocacaoAtual.setText(dataLocacao);
    }   

    @Override
    public String getDataLocacao() {
        return txtDataLocacaoAtual.getText().toString();
    }

    @Override
    public void setDataPagamento(String dataPagamento) {
        txtDataPagamento.setText(dataPagamento);
    }

    @Override
    public String getDataPagamento() {
        return txtDataPagamento.getText().toString();
    }

    @Override
    public void packAndShow() {
        this.pack();
        this.setVisible(true);
    }

    @Override
    public void clearFields() {
        Component[] componentesPainel;
        componentesPainel = painelCentralDTCP.getComponents();
        for (int j = 0; j < componentesPainel.length; j++) {
            if (componentesPainel[j] instanceof JTextField) {
                JTextField field = (JTextField) componentesPainel[j];
                field.setText("");
            }
        }
    }

    @Override
    public void enableTxtValorTotal(boolean arg) {
        txtValorTotal.setEnabled(arg);
    }

    @Override
    public void enableTxtDiasLocacao(boolean arg) {
        txtDiasLocacao.setEnabled(arg);
    }

    @Override
    public void enableTxtValorTotalPagar(boolean arg) {
        txtValorTotalPagar.setEnabled(arg);
    }

    @Override
    public void enableComboTabelaPreco(boolean arg) {
        //combotabelaPreco.setEnabled(arg);
    }

    @Override
    public void enableTxtDataRenovacao(boolean arg) {
        txtDataRenovacao.setEnabled(arg);
    }

    @Override
    public void enableTxtDataPrevDevolucao(boolean arg) {
        txtDataPrevDevolucao.setEnabled(arg);
    }

    @Override
    public void enableBtnConfirmar(boolean arg) {
        btnConfirmar.setEnabled(arg);
    }

    @Override
    public void enableBtnCancelar(boolean arg) {
        btnCancelar.setEnabled(arg);
    }

    @Override
    public void enableBtnRecibo(boolean arg) {
        btnRecibo.setEnabled(arg);
    }

    @Override
    public void editableTxtValorTotal(boolean arg) {
        txtValorTotal.setEditable(arg);
    }

    @Override
    public void editableTxtDiasLocacao(boolean arg) {
        txtDiasLocacao.setEditable(arg);
    }

    @Override
    public void editableTxtValorTotalPagar(boolean arg) {
        txtValorTotalPagar.setEditable(arg);
    }

    @Override
    public void editableComboTabelaPreco(boolean arg) {
        //combotabelaPreco.setEditable(arg);
    }

    @Override
    public void editableTxtDataRenovacao(boolean arg) {
        txtDataRenovacao.setEditable(arg);
    }

    @Override
    public void editableTxtDataPrevDevolucao(boolean arg) {
        txtDataPrevDevolucao.setEditable(arg);
    }

    @Override
    public void setBtnConfirmarRequestFocus(boolean arg) {
        btnConfirmar.requestFocus(arg);
    }

    @Override
    public void setConfirmarActionListener(ActionListener listener) {
        btnConfirmar.addActionListener(listener);
    }

    @Override
    public void setCancelarActionListener(ActionListener listener) {
        btnCancelar.addActionListener(listener);
    }

    @Override
    public void setReciboActionListener(ActionListener listener) {
        btnRecibo.addActionListener(listener);
    }

    @Override
    public void setValorDescontoValor(String valorDesconto) {
        txtValorDescontoValor.setText((valorDesconto));
    }

    @Override
    public double getValorDescontoValor() {
        return Double.parseDouble(txtValorDescontoValor.getText().equals("")?"0":(txtValorDescontoValor.getText().contains(".")?txtValorDescontoValor.getText().replace(".", "").replace(",", "."):txtValorDescontoValor.getText().replace(",",".")));
    }
    
    @Override
    public void setValorDescontoPorcentagem(String valorDesconto) {
        txtValorDescontoPorcentagem.setText((valorDesconto));
    }

    @Override
    public double getValorDescontoPorcentagem() {
        return Double.parseDouble(txtValorDescontoPorcentagem.getText().equals("")?"0":(txtValorDescontoPorcentagem.getText().contains(".")?txtValorDescontoPorcentagem.getText().replace(".", "").replace(",", "."):txtValorDescontoPorcentagem.getText().replace(",",".")));
    }

    @Override
    public void enableTxtValorDesconto(boolean arg) {
        txtValorDescontoValor.setEnabled(arg);
    }

    @Override
    public void editableTxtValorDesconto(boolean arg) {
        txtValorDescontoValor.setEditable(arg);
    }

    @Override
    public void setDescontoActionListener(ActionListener listener) {
        txtValorDescontoValor.addActionListener(listener);
    }
     
    @Override
    public void setDescontoValorFocusListener(FocusListener listener) {
        txtValorDescontoValor.addFocusListener(listener);
    }
    
    @Override
    public void setDescontoPorcentoFocusListener(FocusListener listener) {
        txtValorDescontoPorcentagem.addFocusListener(listener);
    }
    
    @Override
    public void setDiasLocacaoRenovacaoActionListener(ActionListener listener) {
        txtDiasLocacao.addActionListener(listener);
    }

    @Override
    public JTextField getTxtValorDescPorcentagem() {
        return txtValorDescontoPorcentagem;
    }

    @Override
    public void setTxtValorDescPorcentagem(JTextField t) {
        txtValorDescontoPorcentagem = t;
    }

    @Override
    public JTextField getTxtValorDescValor() {
        return txtValorDescontoValor;
    }

    @Override
    public void setTxtValorDescValor(JTextField t) {
        txtValorDescontoValor = t;
    }
    
    @Override
    public void focusGained(FocusEvent e) {
        if(e.getSource()==txtValorTotalLocacaoAtual) {
            txtValorTotalLocacaoAtual.selectAll();
        } else if(e.getSource()==txtValorDescontoValor) {
            txtValorDescontoValor.selectAll();
        } else if(e.getSource()==txtValorTotalPagar) {
            txtValorTotalPagar.selectAll();
        } else if(e.getSource()==txtValorDescontoPorcentagem) {
            txtValorDescontoPorcentagem.selectAll();
        } else if(e.getSource()==txtDiasLocacao) {
            txtDiasLocacao.selectAll();
        }        
    }

    @Override
    public void focusLost(FocusEvent e) {
        //throw new UnsupportedOperationException("Not supported yet.");
    }

    @Override
    public JTextField getDiasLocRenovacao() {
        return txtDiasLocacao;
    }
     
}

